package br.perfiman.service;

import java.util.List;

import br.perfiman.model.AbstractEntity;

/**
 * Interface for the PerFiMan's Bussiness Services
 *
 * @author Wagner Costa
 * @since 27/12/2007
 * @version 1.0
 *
 * @param <Entity>
 */
public interface AbstractService<Entity extends AbstractEntity> {

	/**
	 * Call's the persistence service to insert a new entity to the database
	 *
	 * @author Wagner Costa
	 * @since 27/12/2007
	 * @version 1.0
	 * @param entity
	 * @return
	 * @throws Exception
	 */
	Entity insert(Entity entity) throws Exception;

	/**
	 * Call's the persistence service to update an existing entity in the database
	 *
	 * @author Wagner Costa
	 * @since 27/12/2007
	 * @version 1.0
	 * @param entity
	 * @return
	 * @throws Exception
	 */
	Entity update(Entity entity) throws Exception;

	/**
	 * Call's the persistence service to remove a entity from the database
	 *
	 * @author Wagner Costa
	 * @since 27/12/2007
	 * @version 1.0
	 * @param entity
	 * @throws Exception
	 */
	void remove(Entity entity) throws Exception;

	/**
	 * Call's the persistence service to get a entity from the database using the
	 *  entity's id (AbstractEntity.getEntityId())
	 *
	 * @author Wagner Costa
	 * @since 27/12/2007
	 * @version 1.0
	 * @param id
	 * @return
	 * @throws Exception
	 */
	Entity retrieveById(Object id) throws Exception;

	/**
	 * Call's the persistence service to retrieve all entitys at the database
	 *
	 * @author Wagner Costa
	 * @since 27/12/2007
	 * @version 1.0
	 * @return
	 * @throws Exception
	 */
	List<Entity> retrieveAll() throws Exception;
}
